<!--
 * @Author: wangming
 * @Date: 2021-04-01 14:02:25
 * @LastEditors: wangming
 * @LastEditTime: 2022-02-07 16:54:12
 * @Description: file content
-->
<template>
  <div class="mb20">
    <div class="ks-row-middle mb10 lh1">
      <div class="mr10 g3">正则表达式</div>
      <i
        class="el-icon-circle-plus-outline iconcolor f20 poi"
        @click="addTag"
      ></i>
    </div>
    <div
      class="ks-row-middle g6 mt5 codebg"
      v-for="(item, jdex) in value.__config.regexps"
      :key="jdex"
    >
      <div class="ks-col">{{ item.regexp }}</div>
      <span class="iconfont iconbianji mr10 poi" @click="edit(item)"></span>
      <span class="iconfont iconicon_shanchu poi" @click="remove(jdex)"></span>
    </div>
  </div>
</template>

<script>
import basicmixins from "../basicmixins";
import Module from "./addModule";
export default {
  mixins: [basicmixins],
  methods: {
    remove(index) {
      this.value.__config.regexps.splice(index, 1);
    },
    edit(item) {
      Module.editForm(item).then((res) => {
        Object.assign(item, res);
      });
    },
    addTag() {
      Module.addForm().then((o) => {
        this.value.__config.regexps.push(o);
      });
    },
  },
};
</script>

<style lang="scss" scoped>
.codebg {
  background-color: #f3f9ff;
  padding: 2px 4px;
}
</style>
